<?php

//session_start;
error_reporting(E_ALL & ~E_NOTICE);
session_start();
$goodsname = $_GET['goodsname'];
$price = $_GET['price'];
$picture=$_GET['picture'];
$storename=$_GET['storename'];
$market=$_GET['market'];
$goodsprice=$price;
$goods = $_SESSION['goods'];
if ($goodsname == $goods[$goodsname]['goodsname']){
    $_SESSION['totalprice'] += $price;
    $goods[$goodsname]['number'] += 1;
	$goods[$goodsname]['goodsprice']=$goods[$goodsname]['number']*$price;
	$_SESSION['totalnum']+=$goods[$goodsname]['number'];
}
else{
    $goods[$goodsname]['goodsname'] = $goodsname;
	$goods[$goodsname]['picture'] = $picture;
	$goods[$goodsname]['market'] = $market;
	$goods[$goodsname]['storename'] = $storename;
    $goods[$goodsname]['price'] = $price;
	$goods[$goodsname]['goodsprice'] = $goodsprice;
    $goods[$goodsname]['number'] += 1;
    $_SESSION['totalprice'] += $price;
	$_SESSION['totalnum']+=$goods[$goodsname]['number'];
}

$_SESSION['goods'] = $goods;
header('location: gwc.php');
?>
